package com.acxy.weixin.controller;

import com.acxy.ants.core.annotation.Autowired;
import com.acxy.ants.resful.annotation.Controller;
import com.acxy.ants.resful.annotation.GET;
import com.acxy.ants.resful.annotation.Param;
import com.acxy.weixin.kit.ApiResult;
import com.acxy.weixin.service.WxUserService;

/**
 * @author MrShun
 * @version 1.0
 * @Date 2017-11-04
 */
@Controller("user")
public class WxUserController {

    @Autowired
    private WxUserService userService;

    //根据openid查询用户信息
    @GET("/find")
    public ApiResult find(@Param String openid){
        return userService.getUser(openid);
    }

    /**
     * 公众号给用户进行备注
     * {
    "openid":"oDF3iY9ffA-hqb2vVvbr7qxf6A0Q",
    "remark":"pangzi"
    }
     * @return
     */
    @GET("/remark")
    public Object remark(){
        String body = "{\n" +
                "    \"openid\":\"o1zX7s-v8nLOPgT0xiDQvBJ2JvbE\",\n" +
                "    \"remark\":\"pangzi\"\n" +
                "    }";
        return userService.updateRemark(body);
    }
}
